package com.example.netty.tomcat.http;

import com.example.netty.bio.GPRequest;
import com.example.netty.bio.GPResponse;


/**
 * @author gorkr
 * @date 2022/07/16 16:34
 **/
public abstract class GPServlet {
    public void service(GPRequest request, GPResponse response) throws Exception{
        //由service()方法决定是否调用doGet()还是调用doPost()
        if("GET".equalsIgnoreCase(request.getMethod())){
            doGet(request, response);
        }else {
            doPost(request,response);
        }
    }

    public abstract void doGet(GPRequest request, GPResponse response) throws  Exception;
    public abstract void doPost(GPRequest request, GPResponse response) throws  Exception;
}
    